import request from '@/utils/request'

// 获取左侧树
export function listOrgTree() {
  return request({
    url: '/org/list',
    method: 'get'
  })
}

// 组织架构图树
export function getOrgChartList() {
  return request({
    url: '/org/getOrgChartList',
    method: 'get'
  })
}

// 新增机构
export function addOrg(data) {
  return request({
    url: '/org',
    method: 'post',
    data: data
  })
}

// 修改机构
export function updateOrg(data) {
  return request({
    url: '/org/' + data.id,
    method: 'put',
    data: data
  })
}

// 删除机构
export function deleteOrg(id) {
  return request({
    url: '/org/' + id,
    method: 'delete'
  })
}

// 根据机构id查询详细信息
export function queryOrgDetail(data) {
  return request({
    url: '/org/queryOrgDetail',
    method: 'get',
    params: data
  })
}

export function queryOrgDetailView(data) {
  return request({
    url: '/org/getOrgDetailView',
    method: 'get',
    params: data
  })
}

export function selectRule(data) {
  return request({
    url: '/org/selectRule',
    method: 'post',
    data: data
  })
}

export function getTreeSelect(){
  return request({
    url: '/org/listTreeSelect',
    method: 'get'
  })
}

export function getOrgs(){
  return request({
    url: '/org/listSelect',
    method: 'get'
  })
}

export function orgDistribute(data) {
  return request({
    url: '/org/orgDistribute',
    method: 'post',
    data: data
  })
}
